//
//  BMITestCell.m
//  Romens.XSBalance
//
//  Created by 李美东 on 16/3/2.
//  Copyright © 2016年 孙博. All rights reserved.
//

#import "BMITestCell.h"
#import "ToolHelper.h"
@implementation BMITestCell
-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self=[super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self)
    {
        _showImage=[[UIImageView alloc]init];
        _showImage.translatesAutoresizingMaskIntoConstraints=NO;
        [self.contentView addSubview:_showImage];
        
        _nameLabel=[[UILabel alloc]init];
        _nameLabel.translatesAutoresizingMaskIntoConstraints=NO;
        [self.contentView addSubview:_nameLabel];
        
        _showValueLabel=[[UILabel alloc]init];
        _showValueLabel.translatesAutoresizingMaskIntoConstraints=NO;
        _showValueLabel.text=@"--";
        [_showValueLabel sizeToFit];
        [self.contentView addSubview:_showValueLabel];
        
        _healthScore=[[UILabel alloc]init];
        _healthScore.translatesAutoresizingMaskIntoConstraints=NO;
        [_healthScore sizeToFit];
        [self.contentView addSubview:_healthScore];
        
        
        [self.contentView addConstraints:[ToolHelper GetNSLayoutCont:NSDictionaryOfVariableBindings(_showImage,_nameLabel,_showValueLabel,_healthScore)  format:@"H:|-10-[_showImage(30)]-[_nameLabel(60)]-30-[_showValueLabel(80)]-[_healthScore]-|"]];
        [self.contentView addConstraints:[ToolHelper GetNSLayoutCont:NSDictionaryOfVariableBindings(_showImage)  format:@"V:[_showImage(30)]"]];
        
        [self.contentView addConstraints:[ToolHelper GetNSLayoutCont:NSDictionaryOfVariableBindings(_nameLabel)  format:@"V:[_nameLabel(30)]"]];
        [self.contentView addConstraints:[ToolHelper GetNSLayoutCont:NSDictionaryOfVariableBindings(_showValueLabel)  format:@"V:[_showValueLabel(30)]"]];
        [self.contentView addConstraints:[ToolHelper GetNSLayoutCont:NSDictionaryOfVariableBindings(_healthScore)  format:@"V:[_healthScore(30)]"]];
        
        [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:_showImage
                                                                     attribute:NSLayoutAttributeCenterY
                                                                     relatedBy:NSLayoutRelationEqual
                                                                        toItem:self.contentView                                                    attribute:NSLayoutAttributeCenterY
                                                                    multiplier:1.0f
                                                                      constant:0]];
        [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:_nameLabel
                                                                     attribute:NSLayoutAttributeCenterY
                                                                     relatedBy:NSLayoutRelationEqual
                                                                        toItem:self.contentView                                                    attribute:NSLayoutAttributeCenterY
                                                                    multiplier:1.0f
                                                                      constant:0]];
        [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:_showValueLabel
                                                                     attribute:NSLayoutAttributeCenterY
                                                                     relatedBy:NSLayoutRelationEqual
                                                                        toItem:self.contentView                                                    attribute:NSLayoutAttributeCenterY
                                                                    multiplier:1.0f
                                                                      constant:0]];
        [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:_healthScore
                                                                     attribute:NSLayoutAttributeCenterY
                                                                     relatedBy:NSLayoutRelationEqual
                                                                        toItem:self.contentView                                                    attribute:NSLayoutAttributeCenterY
                                                                    multiplier:1.0f
                                                                      constant:0]];
        
        
    }
    return self;
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
